package com.gw.detail.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gw.detail.domain.Anprall;
import com.gw.detail.mapper.AnprallMapper;
import com.gw.detail.service.IAnprallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * 人员的单个碰撞Service业务层处理
 *
 * @author WangBin
 * @date 2021-04-30
 */
@Service
public class AnprallServiceImpl extends ServiceImpl<AnprallMapper, Anprall> implements IAnprallService {
    @Autowired
    private AnprallMapper anprallMapper;

    /**
     * 查询人员的单个碰撞
     *
     * @param id 人员的单个碰撞ID
     * @return 人员的单个碰撞
     */
    @Override
    public Anprall selectAnprallById(Long id) {
        return anprallMapper.selectAnprallById(id);
    }

    @Override
    public Anprall selectAnprallByParticipantNumber(Long participantNumber) {
        return getOne(Wrappers.lambdaQuery(Anprall.class).eq(Anprall::getBetnr, participantNumber));
    }

    /**
     * 查询人员的单个碰撞列表
     *
     * @param anprall 人员的单个碰撞
     * @return 人员的单个碰撞
     */
    @Override
    public List<Anprall> selectAnprallList(Anprall anprall) {
        return anprallMapper.selectAnprallList(anprall);
    }

    /**
     * 新增人员的单个碰撞
     *
     * @param anprall 人员的单个碰撞
     * @return 结果
     */
    @Override
    public int insertAnprall(Anprall anprall) {
        return anprallMapper.insertAnprall(anprall);
    }

    /**
     * 修改人员的单个碰撞
     *
     * @param anprall 人员的单个碰撞
     * @return 结果
     */
    @Override
    public int updateAnprall(Anprall anprall) {
        return anprallMapper.updateAnprall(anprall);
    }

    /**
     * 批量删除人员的单个碰撞
     *
     * @param ids 需要删除的人员的单个碰撞ID
     * @return 结果
     */
    @Override
    public int deleteAnprallByIds(Long[] ids) {
        return anprallMapper.deleteAnprallByIds(ids);
    }

    /**
     * 删除人员的单个碰撞信息
     *
     * @param id 人员的单个碰撞ID
     * @return 结果
     */
    @Override
    public int deleteAnprallById(Long id) {
        return anprallMapper.deleteAnprallById(id);
    }
}
